﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SISGEZATBZVisual.BusinessEntities;

namespace SISGEZATBZVisual.Repository.Mapping
{
    public class VisitaAdicionalAipMap:EntityTypeConfiguration<VisitaAdicionalAip>
    {
        public VisitaAdicionalAipMap()
        {
            this.HasKey(r => r.Id);

            //propiedades
            this.Property(r => r.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(r => r.SalaDeTrabajo)
                .IsRequired().HasMaxLength(70);

            this.Property(r => r.FechaReserva)
               .IsRequired();

            this.Property(c => c.HoraInicio)
            .IsRequired();

            this.Property(c => c.HoraFin)
            .IsRequired();

            //table
            this.ToTable("Visita Adicional Aip");

            //Relaciones
            this.HasRequired(r => r.Docente)
                .WithMany()
                .HasForeignKey(r => r.IdDocente)
                .WillCascadeOnDelete(false);
        }
    }
}
